import moment from 'moment';
// 命名规范：Arr普通枚举  field下拉字段枚举  Map表格字段枚举

// 表头筛选字段
const headerForm = {};
// 表格字段
const tableColumn = {
  // 表格列表
  educationTableMap: [
    { prop: 'id', type: 'text', label: 'ID' },
    { prop: 'eduImages', type: 'image', label: '毕业证照片' },
    { prop: 'eduStr', type: 'text', label: '学历' },
    { prop: 'eduTypeStr', type: 'text', label: '院校性质' },
    { prop: 'school', type: 'text', label: '毕业院校' },
    { prop: 'auditStatusStr', type: 'text', label: '审核状态' },
    { prop: 'auditTypeStr', type: 'text', label: '审核类型' },
    { prop: 'auditBy', type: 'text', label: '审核人' },
    { prop: 'replyContent', type: 'text', label: '驳回原因', tooltip: true },
    { prop: 'commitment', type: 'text', label: '承诺书' },
    { prop: 'auditTime', type: 'text', label: '审核时间', tooltip: true },
    { prop: 'createdTime', type: 'text', label: '创建时间', tooltip: true },
    { prop: 'updateTime', type: 'text', label: '更新时间', tooltip: true },
  ],
};
// 表单字段
const editForm = {
  // 筛选表单
  educationFilterMap: [
    { prop: 'realName', type: 'input', label: '真实姓名', clearable: true, col: 0 },
    {
      prop: 'eduTypeId',
      type: 'select',
      label: '院校性质',
      clearable: true,
      filterable: true,
      optionDynamic: {
        apiKey: 'EduTypeOption',
        params: {},
        methods: 'get',
      },
      optionValue: 'id',
      optionLabel: 'eduTypeName',
      col: 0,
    },
    {
      prop: 'eduId',
      type: 'select',
      label: '学历',
      clearable: true,
      filterable: true,
      optionDynamic: {
        apiKey: 'EduOption',
        params: {},
        methods: 'get',
      },
      optionValue: 'id',
      optionLabel: 'eduName',
      col: 0,
    },
    { prop: 'school', type: 'input', label: '毕业院校', clearable: true, col: 0 },
    { prop: 'auditType', type: 'select', label: '审核类型', clearable: true, filterable: true, optionKey: 'AUDIT_TYPE', col: 0 },
    { prop: 'auditStatus', type: 'select', label: '审核状态', clearable: true, filterable: true, optionKey: 'APPROVE_STATUS', col: 0 },
    {
      prop: 'auditTimeStartTime',
      label: '审核开始时间',
      type: 'datePicker',
      dateType: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd',
      pickerOptions: {
        disabledDate: function (time) {
          return time.getTime() > moment().format('x');
        },
      },
      clearable: true,
      col: 0,
    },
    {
      prop: 'auditTimeEndTime',
      label: '审核结束时间',
      type: 'datePicker',
      dateType: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd',
      pickerOptions: {
        disabledDate: function (time) {
          return time.getTime() > moment().format('x');
        },
      },
      clearable: true,
      col: 0,
    },
  ],
  // 新增/修改表单
  educationFormMap: [
    { prop: 'auditStatus', type: 'radio', label: '审核状态', optionKey: 'APPROVE_STATUS', col: 24 },
    { prop: 'auditType', type: 'select', label: '审核类型', clearable: true, optionKey: 'AUDIT_TYPE', col: 24 },
    {
      prop: 'eduImages',
      type: 'upload',
      label: '毕业证照片',
      clearable: true,
      col: 24,
      plusStyle: { width: '200px', height: '200px', fontSize: '50px' },
      imageStyle: { width: '200px', height: '200px', display: 'block' },
    },
    { prop: 'replyContent', type: 'textarea', label: '驳回原因', row: 5, clearable: true, col: 24 },
  ],
};
// 其他映射
const otherMap = {};
// 表单字段校验
const editRule = {
  educationFormRule: {
    auditStatus: [{ required: true, message: '请选择审核状态', trigger: 'change' }],
    auditType: [{ required: true, message: '请选择审核类型', trigger: 'change' }],
    eduImages: [{ required: true, message: '请上传毕业证照片', trigger: 'change' }],
    replyContent: [{ required: true, message: '驳回原因不能为空', trigger: 'blur' }],
  },
};
export default {
  headerForm,
  tableColumn,
  editForm,
  otherMap,
  editRule,
};
